﻿using DocumentFormat.OpenXml.Lite.Helper;
using DocumentFormat.OpenXml.Lite.SpreadsheetML.Excel.Types;
using DocumentFormat.OpenXml.Lite.SpreadsheetML.Excel.WorksheetElements;
using DocumentFormat.OpenXml.Lite.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace DocumentFormat.OpenXml.Lite.SpreadsheetML.Excel.Table
{
    [XmlRoot("tableColumn", Namespace = Constants.ExcelMain)]
    public class TableColumn : XmlSerializable
    {
        #region Attributes

        [XmlAttribute("id", Form = XmlSchemaForm.Qualified)]
        public int Id { get; set; }

        [XmlAttribute("name", Form = XmlSchemaForm.Qualified)]
        public string Name { get; set; }

        [Optional]
        [XmlAttribute("uniqueName", Form = XmlSchemaForm.Qualified)]
        public string UniqueName { get; set; }

        [Optional]
        [XmlAttribute("totalsRowFunction", Form = XmlSchemaForm.Qualified)]
        public Nullable<ST_TotalsRowFunction> TotalsRowFunction { get; set; }

        [Optional]
        [XmlAttribute("totalsRowLabel", Form = XmlSchemaForm.Qualified)]
        public string TotalsRowLabel { get; set; }

        [Optional]
        [XmlAttribute("queryTableFieldId", Form = XmlSchemaForm.Qualified)]
        public Nullable<uint> QueryTableFieldId { get; set; }

        [Optional]
        [XmlAttribute("headerRowDxfId", Form = XmlSchemaForm.Qualified)]
        public Nullable<uint> HeaderRowCellFormatId { get; set; }

        [Optional]
        [XmlAttribute("dataDxfId", Form = XmlSchemaForm.Qualified)]
        public Nullable<uint> DataAndInsertRowFormatId { get; set; }

        [Optional]
        [XmlAttribute("totalsRowDxfId", Form = XmlSchemaForm.Qualified)]
        public Nullable<uint> TotalsRowFormatId { get; set; }

        [Optional]
        [XmlAttribute("headerRowCellStyle", Form = XmlSchemaForm.Qualified)]
        public string HeaderRowCellStyle { get; set; }

        [Optional]
        [XmlAttribute("dataCellStyle", Form = XmlSchemaForm.Qualified)]
        public string DataCellStyle { get; set; }

        [Optional]
        [XmlAttribute("totalsRowCellStyle", Form = XmlSchemaForm.Qualified)]
        public string TotalsRowCellStyle { get; set; }

        #endregion

        #region Elements

        [Optional]
        [XmlElement("calculatedColumnFormula", Namespace = Constants.ExcelMain)]
        public CalculatedColumnFormula CalculatedColumnFormula { get; set; }

        [Optional]
        [XmlElement("totalsRowFormula", Namespace = Constants.ExcelMain)]
        public TotalsRowFormula TotalsRowFormula { get; set; }

        [Optional]
        [XmlElement("xmlColumnPr", Namespace = Constants.ExcelMain)]
        public XmlColumnProperties Properties { get; set; }

        [Optional]
        [XmlElement("extLst", Namespace = Constants.ExcelMain)]
        public ExtensionList ExtensionList { get; set; }

        #endregion

        public TableColumn() { }

    }
}
